package com.niuxiaofa.newlaw.View;

import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.niuxiaofa.newlaw.R;


public class BlindBoxDialog extends AlertDialog {
    private TextView title, content,ok;
    private ImageView  close;
    public Onclick onclick;
    public String title_text,content_text;
    public BlindBoxDialog(Context context,String  title,String content, Onclick onclick) {
        this(context, R.style.AlertDialog);
        this.title_text=title;
        this.onclick = onclick;
        this.content_text=content;
    }

    public BlindBoxDialog(Context context, int i) {
        super(context, i);
    }


    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.dialog_blind_box);
        this.title = findViewById(R.id.title);
        this.ok = findViewById(R.id.ok);
        this.close = findViewById(R.id.close);
        content = findViewById(R.id.content);


        this.title.setText(title_text);
        this.content.setText(content_text);
        close.setOnClickListener(e -> {
            dismiss();
        });

        ok.setOnClickListener(e -> {
            onclick.click();
            dismiss();
        });

    }

    public interface Onclick {
        void click();
    }

}
